package com.github_Dididipapa.shortlink.admin.feign;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github_Dididipapa.shortlink.admin.common.result.R;
import com.github_Dididipapa.shortlink.admin.config.FeignConfig;
import com.github_Dididipapa.shortlink.admin.remote.dto.req.LinkUpdateReqDTO;
import com.github_Dididipapa.shortlink.admin.remote.dto.req.PageReqDTO;
import com.github_Dididipapa.shortlink.admin.remote.dto.req.RecycleBinLinkReqDTO;
import com.github_Dididipapa.shortlink.admin.remote.dto.resp.LinkGroupCountRespDTO;
import com.github_Dididipapa.shortlink.admin.remote.dto.resp.PageRespDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description: 短链接远程调用接口
 * @author: dididi_papa
 * @email: mitis1624087624@gmail.com
 * @date: 2025/09/16  16:38
 */
@FeignClient(
        name = "short-link-gateway",
        url = "localhost:88",
        contextId = "projectFeign",
        configuration = FeignConfig.class
)
public interface ProjectFeign {

    /**
     * 获取短链接统计信息
     */
    @GetMapping("/api/short-link/core/v1/count")
    R<List<LinkGroupCountRespDTO>> listGroupShortLinkCount(List<String> reqestParams);
    
    /**
     * 修改短链接
     */
    @PostMapping("/api/short-link/core/v1/update")
    R<Void> updateLink(@RequestBody LinkUpdateReqDTO linkReqDTO);

    /**
     * 分页查询短链接
     */
    @GetMapping("/api/short-link/core/v1/page")
    R<IPage<PageRespDTO>> page(@RequestBody PageReqDTO requestParam);

    /**
     * 查询url的标题
     */
    @GetMapping("/api/short-link/core/v1/title")
    R<String> getUrlTitle(@RequestParam("url") String url);

    /**
     * 短链接加入回收站
     */
    @DeleteMapping("/api/short-link/core/recycle-bin/save")
    R<Void> recycleBinSave(@RequestBody RecycleBinLinkReqDTO recycleBinLinkReqDTO);
}
